package com.usian.controller;

import com.github.pagehelper.PageInfo;
import com.usian.config.FeignGood;
import com.usian.shop.entity.Good;
import com.usian.shop.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/good")
public class ControllerGood {
    @Autowired
    private FeignGood feignGood;
    @RequestMapping("/findAll")
    public PageInfo findAll(@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize){
return feignGood.findAll(pageNum,pageSize);
    }
    @PostMapping("/update")
    public ResponseResult update(@RequestBody Good good){
        try {
            feignGood.update(good);
            return ResponseResult.errorResult(200,"下单成功");
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseResult.errorResult(500,"下单失败");
        }
    }
}
